#!/bin/bash
# iterate through all files in a directory

for file in $HOME/*; do
    # 这里加"$file" 是为了确保文件名出现空格的时候不至于出错
    if [ -d "$file" ]; then
        echo "$file is a directory."
    fi
    if [ -f "$file" ]; then
        echo "$file is a file."
    fi
done
